import java.util.Vector;

public class Node {
  public State state;     
  public int f;           
  public int g;           
  public int h;           
  public int cost;       
  public Node ancestor;   
  
  public Node(State s, int cost) {
    this.state = s;
    this.cost = cost;
  }
  
  public boolean equals(Node n) {
    if (state.equals(n.state)) {
      return true;
    } else {
      return false;
    }
  }
  
  public String toString() {
    return "State=" + state.toString() + ", f=" + f + ", g=" + g + ", h=" + h;
  }
  
  public boolean hasAncestor() {
    if (ancestor != null) {
      return true;
    } else {
      return false;
    }
  }
  
  public Vector<Node> successors () {
	 Vector<Node> nodes = new Vector<Node>();
	 Vector<State> states = state.successors();
	 for (int i = 0; i < states.size(); i++) {
		nodes.add(0, new Node(states.elementAt(i), 1));
	 }
	 return nodes;
  }
  

  public int estimate(Node goalnode) {
	 return state.estimate(goalnode.state);
  }
}